package com.lsy.android.pingpang.tool;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class SharePerenceHelp {

	private final static String PREFERENCE_LEVLE = "level";
	private final static String PREFERENCE_MODE = "mode";

	public static void saveLevel(Context context, int value) {
		SharedPreferences preferences = PreferenceManager
				.getDefaultSharedPreferences(context);
		preferences.edit().putInt(PREFERENCE_LEVLE, value).commit();
	}

	public static int getLevel(Context context) {
		SharedPreferences preferences = PreferenceManager
				.getDefaultSharedPreferences(context);
		return preferences.getInt(PREFERENCE_LEVLE, 0);
	}

	public static void saveGameMode(Context context, int value) {
		SharedPreferences preferences = PreferenceManager
				.getDefaultSharedPreferences(context);
		preferences.edit().putInt(PREFERENCE_MODE, value).commit();
	}

	public static int getGameMode(Context context) {
		SharedPreferences preferences = PreferenceManager
				.getDefaultSharedPreferences(context);
		return preferences.getInt(PREFERENCE_MODE, 0);
	}

}
